﻿using System;
using System.Windows.Input;

namespace CodeCounsel.SharePoint.RibbonDesigner.ViewModel
{
    public class DelegateCommand
        : ICommand
    {
        public Action<object> ExecuteAction { get; set; }
        public Func<object, bool> CanExecuteAction { get; set; }

        public bool CanExecute(object parameter)
        {
            return CanExecuteAction(parameter);
        }
        
        public void Execute(object parameter)
        {
            ExecuteAction(parameter);
        }
    
        public event EventHandler CanExecuteChanged;
    }
}
